package com.itcs.app.util;

import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
 * 日志主函数
 * @author Administrator
 *
 */
public class LogHandlerUtil{
	private static final Log LOG = LogFactory.getLog(LogHandlerUtil.class);
	/**
	 * 增加写文件日志
	 * 高速日志类
	 * @param LOG
	 * @param title
	 * @param message
	 */
	public static void addMainLog(Log LOG, Long groupid, String jsonString){
		addMainLog(LOG,groupid,null,null,jsonString);
	}
	
	public static void addMainLog(Log LOG, String jsonString){
		addMainLog(LOG,0L,null,null,jsonString);
	}
	
	public static void addMainLog(Long timel, String jsonString){
		addMainLog(LOG,timel,null,null,jsonString);
	}
	
	public static void addMainLog(Log LOG, String title,String message){
		addMainLog(LOG,0L,title,message);
	}
	
	public static void addMainLog(Log LOG, String title,String message, String jsonString){
		addMainLog(LOG,0L,title,message,jsonString);
	}


	public static void addMainLog(Log LOG, Long groupid, String title, String jsonString){
		addMainLog(LOG,groupid,title,jsonString,null);
	}

	/**
	 * 增加写文件日志
	 * 高速日志类
	 * @param LOG
	 * @param title
	 * @param message
	 */
	public static void addMainLog(Log LOG,Long timel, String title,String message, String jsonString,String... text){
		if(LOG==null){
			LOG = LogHandlerUtil.LOG;
		}
		StringBuffer sbr = new StringBuffer();
		sbr.append(timel+" #"+title+" #"+message+" #"+jsonString);
		for (int i = 0; i < text.length; i++) {
			sbr.append("#"+text[i]);
		}
		LOG.info(sbr.toString());
//		System.out.println(sbr.toString());
	}
	/**
	 * 增加写库日志
	 * @param title
	 * @param text
	 */
	public static void addDebugLog(String title, String text){
//		sysLogDao.addDebugLog(title, text);
	}
	
}